<?php
session_start();
if(!@$_SESSION['username']) {
  echo "<script>window.location.href='login.php';</script>";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>车站删除</title>
</head>
<body>
	<?php
		include_once('../../libraries/esaydb.class.php');
		if($_GET) {
			$sid = $_GET['sid'];
			$db = new EasyDB();
			$where = array(
				'sid' => $sid
            );
            $result = $db->delete('ob_station',$where);

            $ticketDel = array(
                'sid' => $sid
            );
            $ticketResult = $db->delete('ob_ticket',$ticketDel);
            if($result && $ticketResult) {
                echo "<script>alert('删除成功');window.location.href='../../station-list.php'</script>";
			}else{
				echo "<script>alert('删除失败');history.go(-1);</script>";
			}
		}else{
			echo "<script>alert('参数错误');history.go(-1);window.close();';</script>";
		}
	?>
</body>
</html>
